package top.humbleyuan.designmode.proxy.statical;


import java.util.HashMap;

/**
 * @Author HumbleYuan
 * @Date 2019/11/20 13:53
 * @Des
 */
public class TransactionProxy implements Transaction {

    private Transaction transaction;

    TransactionProxy () {
        this.transaction = new TransactionImpl();
    }

    @Override
    public void start() {
        System.out.println("模拟事务开启后不自动提交...");
        this.transaction.start();
    }

    @Override
    public void rollback() {
        this.transaction.rollback();
        System.out.println("模拟回滚撤回操作...");
    }

    @Override
    public void close() {
        System.out.println("模拟关闭前关闭其他资源...");
        this.transaction.close();
    }

}
